<?php
	/**
	 * @ignore
	 */
	if(defined("def_".__FILE__)) return;	
	define("def_".__FILE__,"def_".__FILE__);
/**
 * Simple class for managing cookies 
 * 
 * @package apl
 * @subpackage helpers
 *
 */
class AplCookie{
 	private $Domain;

 	public function __construct($DomainName)
 	{
 		$this->Domain = $DomainName;
 	}
 	/**
	  * Set Cookie
	  * @param String Cookie Name
	  * @param String Cookie Value
	  * @param Integer Days That Cookie Will Last
	  */
	public function writeCookie( $cookieName, $cookieValue,$daysBeforeExpire)
	{
		setcookie($cookieName,$cookieValue,time()+(60*60*24*$daysBeforeExpire),"",$this->Domain);
	}
	/**
	  *	Executes a query
	  * @param String CookieName
	  * @param String Default Value Of The Cookie if No Cookie exists in client
	  */
	public function readCookie( $cookieName, $cookieDefaultValue=null)
	{
		if( isset($_COOKIE[$cookieName]))
			return $_COOKIE[$cookieName];
		else
			return $cookieDefaultValue;
	}
}
?>